#!/bin/bash

echo "🚀 启动企业公告智能监控大屏系统..."

# 检查Python版本
python3 --version

# 安装依赖（如果需要）
if [ ! -d "venv" ]; then
    echo "📦 创建虚拟环境..."
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements_dashboard.txt
else
    source venv/bin/activate
fi

# 检查数据库是否存在
if [ ! -f "announcements.db" ]; then
    echo "⚠️  警告: 未找到数据库文件 announcements.db"
    echo "请确保已运行公告抓取程序生成数据库"
fi

# 启动服务
echo "🌟 启动大屏服务..."
echo "📱 访问地址:"
echo "   总览大屏: http://localhost:8000/"
echo "   来源分析: http://localhost:8000/source"
echo "   情感分析: http://localhost:8000/sentiment"  
echo "   风险监控: http://localhost:8000/risk"
echo "   系统状态: http://localhost:8000/system"
echo "   API文档:  http://localhost:8000/docs"
echo ""

python3 dashboard_api.py 